do not refresh except on page 1

Andrew Cantino 10 年 前
コミット
630f614aa0
共有2 個のファイルを変更した4 個の追加2 個の削除を含む
  1. 3 2
      app/assets/javascripts/components/worker-checker.js.coffee
  2. 1 0
      app/controllers/jobs_controller.rb

+ 3 - 2
app/assets/javascripts/components/worker-checker.js.coffee

@@ -41,8 +41,9 @@ $ ->
41 41
         sinceId ?= json.max_id
42 42
         currentJobs = [json.pending, json.awaiting_retry, json.recent_failures]
43 43
         if document.location.pathname == '/jobs' && $(".modal[aria-hidden=false]").length == 0 && previousJobs? && previousJobs.join(',') != currentJobs.join(',')
44
-          $.get '/jobs', (data) =>
45
-            $("#main-content").html(data)
44
+          if !document.location.search || document.location.search == '?page=1'
45
+            $.get '/jobs', (data) =>
46
+              $("#main-content").html(data)
46 47
         previousJobs = currentJobs
47 48
 
48 49
         window.workerCheckTimeout = setTimeout check, 2000

+ 1 - 0
app/controllers/jobs_controller.rb

@@ -49,6 +49,7 @@ class JobsController < ApplicationController
49 49
   end
50 50
 
51 51
   private
52
+
52 53
   def running?
53 54
     (@job.locked_at || @job.locked_by) && @job.failed_at.nil?
54 55
   end